/*
 * Copyright © 2018 Cask Data, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
*/

@import '../../../styles/variables.scss';
@import '../../../styles/mixins.scss';

$border-color: $grey-05;

.pipeline-details-run-level-info {
  width: 100%;
  height: 55px;
  border-bottom: 1px solid $border-color;
  z-index: 1;
  color: $grey-02;
  position: absolute;
  background-color: $grey-08;
  padding-left: 10px;
  display: flex;

  .run-info-container {
    display: inline-block;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 10px;
    text-align: center;
    position: relative;
    height: 100%;

    /* Have to do this instead of height: 100% because of issue in Firefox */
    height: 54px;
    &:after {
      @include border-element();
    }

    .popper {
      padding: 0;
    }
  }
  .run-container {
    display: flex;
    justify-content: space-between;
    flex: 1;
    position: relative;
    background-color: $grey-06;
    padding-right: 100px;

    &:before {
      content: '';
      border: 10px solid $grey-06;
      width: 0;
      border-top-color: transparent;
      border-left-color: transparent;
      border-bottom-color: transparent;
      height: 10px;
      position: absolute;
      top: 15px;
      left: -20px;
    }
  }

  div.run-number-container {
    padding-left: 0;
    padding-right: 20px;
    text-align: left;
    bottom: 1px;

    h4.run-number {
      font-weight: bold;
      margin-top: 0;
      margin-bottom: 0;
    }

    .run-number-switches {
      display: flex;
      align-items: center;
      justify-content: center;
      button {
        border: 0;
        outline: 0;
        padding: 0;
        background-color: $grey-08;

        .icon-svg {
          color: $grey-03;
          font-size: 26px;
        }

        &:disabled {
          opacity: 0.5;
        }
      }
    }
    &:after {
      display: none;
    }
  }

  .run-status-container {
    .run-status-bubble {
      padding-right: 3px;

      &.status-light-grey { color: $grey-03; }
      &.status-light-green { color: $green-01; }
      &.status-light-red { color: $red-02; }
      &.status-blue { color: $blue-02; }

      .icon-svg {
        transform: translateY(-1px);
      }
    }
  }

  .run-configs-container,
  .run-logs-container {
    padding: 0;

    &.active,
    &:hover {
      background-color: $grey-10;

      &:after {
        display: none;
      }

      &:before {
        border-color: $grey-10;
      }
    }

    &.disabled {
      cursor: not-allowed;

      .run-configs-btn,
      .run-logs-btn {
        opacity: 0.65;
      }
    }
  }

  .run-logs-container {
    cursor: pointer;

    .run-logs-btn {
      border: 1px solid transparent;
      color: $grey-02;
      text-decoration: none;
      padding: 10px 15px 0 15px;
    }
  }

  .run-configs-container {
    position: relative;

    &:after {
      right: -16px;
    }

    .run-configs-btn {
      border: 1px solid transparent;
      padding: 10px 15px 0 15px;
      cursor: pointer;
    }

    .icon-sliders {
      transform: rotate(90deg);
      font-size: 18px;
    }
  }

  .run-status-container {
    min-width: 120px;
  }

  .run-errors-container {
    &:after {
      display: none;
    }
  }
}

.pipeline-modeless-container {
  .historical-runtime-args-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    padding: 0 15px 15px;
    h4 {
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .historical-runtimeargs-keyvalues {
      text-align: left;
      padding: 10px 0;
      height: calc(100% - 45px);
      max-height: 700px;
      overflow-y: auto;
      margin-bottom: 10px;

      > div {
        padding: 5px 0;
        &:first-child {
          color: gray;
          font-weight: 500;
        }
        .form-control {
          font-size: 14px;
        }
      }
    }
  }

  .runconfig-modeless-title {
    display: flex;
    .copyable-id {
      font-size: 12px;
    }
  }

  .runconfig-tab-footer {
    border-top: 1px solid $grey-05;
    text-align: right;
    padding: 15px 0;
  }
}
